<?php

class SimCMSUserController extends Zend_Controller_Action {

    public function init() {
        /* Initialize action controller here */
    }

    public function indexAction() {
        $user = new Application_Model_SimCMSUserMapper();
        $this->view->entries = $user->fetchAll();
    }

    public function addAction() {
        $request = $this->getRequest();
        $form = new Application_Form_SimCMSUser();
        if ($this->getRequest()->isPost()) {
            if ($form->isValid($request->getPost())) {
                $model = new Application_Model_SimCMSUser($form->getValues());
                $user = new Application_Model_SimCMSUserMapper();
                $user->save($model);
                return $this->_helper->redirector('index');
            } 
        }

        $this->view->form = $form;
    }

}

